<%--
  Created by IntelliJ IDEA.
  User: xiangty 
  Date: 2018-03-27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>out内置对象</title>
</head>
<body>

    <h3>常用方法:</h3>
    <ol>
        <li>void println() 向客户端打印字符串</li>
        <li>void clear() 清除缓冲区的内容,如果在flush之后调用会抛出异常</li>
        <li>void clearBuffer() 清除缓冲区的内容,如果在flush之后调用不会抛出异常</li>
        <li>void flush() 将缓冲区的内容输出到客户端</li>
        <li>int getBufferSize() 返回缓冲区以字节数的大小,如果不设置缓冲区则为0</li>
        <li>int getRemaining() 返回缓冲区还剩余多少可用</li>
        <li>boolean isAutoFlush() 返回缓冲区时,是自动清空还是抛出异常</li>
        <li>void close() 关闭输出流</li>
    </ol>

    <hr>

    <h3>demo示例:</h3>
    <%
        out.print("<h4>静夜思</h2>");
        out.print("床前明月光<br>");
        out.print("疑是地上霜<br>");
//        out.flush();       //将缓冲区的内容输出到客户端 (明显的变化是,剩余缓冲区的大小会发变化)
//        out.clear();       //清除缓冲区的内容,如果在flush之后调用会抛出异常
//        out.clearBuffer();      //清除缓冲区的内容,如果在flush之后调用不会抛出异常
        out.print("举头望明月<br>");
        out.print("低头思故乡<br>");
    %>

    缓冲区大小: <%=out.getBufferSize() %>byte  <br>
    缓冲区剩余大小: <%=out.getRemaining() %>byte <br>
    是否自动清空缓冲区: <%=out.isAutoFlush() %>  <br>

    <%
         out.close(); //关闭流
    %>
</body>
</html>
